package com.beyond.trace.dy.controller;

import com.beyond.trace.dy.domain.*;
import com.beyond.trace.dy.service.ITraceDyStatisticsService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.github.pagehelper.page.PageMethod.startPage;

/**
 * 统计分析Controller
 * 
 * @author Mr.Yao
 * @date 2022-04-08
 */
@RestController
@RequestMapping("/dy/statistics")
@Api(value = "统计管理", tags = "统计管理")
public class TraceDyStatisticsController extends BaseController
{
    @Autowired
    private ITraceDyStatisticsService traceDyStatisticsService;

    /**
     * 入库统计
     * @param storeIncrease
     * @return
     */
    @GetMapping("/increase")
    @ApiOperation("入库统计")
    public TableDataInfo increase(StoreIncrease storeIncrease)
    {
        startPage();
        List<StoreIncrease> list = traceDyStatisticsService.selectStoreIncreaseList(storeIncrease);
        return getDataTable(list);
    }

    /**
     * 出库统计
     * @param storeDecrease
     * @return
     */
    @GetMapping("/decrease")
    @ApiOperation("入库统计")
    public TableDataInfo decrease(StoreDecrease storeDecrease)
    {
        startPage();
        List<StoreDecrease> list = traceDyStatisticsService.selectStoreDecreaseList(storeDecrease);
        return getDataTable(list);
    }
    /**
     * 库存统计
     * @param storeStore
     * @return
     */
    @GetMapping("/store")
    @ApiOperation("入库统计")
    public TableDataInfo store(StoreStore storeStore)
    {
        startPage();
        List<StoreStore> list = traceDyStatisticsService.selectStoreStoreList(storeStore);
        return getDataTable(list);
    }
    /**
     * 库存折损统计
     * @param productId
     * @return
     */
    @GetMapping("/storeloss")
    @ApiOperation("入库统计")
    public TableDataInfo storeLoss(@RequestParam(value = "productId",required = false) String productId)
    {
        startPage();
        List<StoreLoss> list = traceDyStatisticsService.selectStoreLossList(productId);
        return getDataTable(list);
    }


}
